package com.akka.hello

import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.Identify
import akka.actor.ActorIdentity

class HelloActor extends Actor{
  def receive = {
    case x => {
      println("HelloActor::"+x)
      sender ! ("1234",self)
    }
  }
}

class HelloActorSender extends Actor{
  def receive = {
    case i:ActorIdentity => {
      println("Sender**"+i.correlationId+"-----"+i.getRef)
    }
    case x => println("sender::"+x)
  }
}
object HelloAkka extends App {
  val system = ActorSystem("hello-akka-actorsystem");
  val hello = system.actorOf(Props[HelloActor],name="helloActor")
  val s = system.actorOf(Props[HelloActorSender],name="helloSender")
  //hello.tell("hello akka world",s)
  hello.tell(Identify("hello identy"),s)
  Thread.sleep(1000)
  system shutdown
}